package maven.jyhs.com.proxy.dynamic;

import java.lang.reflect.Proxy;

/**
 * 代理工厂类
 */
public class ProxyFactory {
    public static <T> T create(Object target) {
        ProxyHandler handler = new ProxyHandler();
        handler.setTarget(target);
        return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),
                handler);
    }
}
